In the UNIX Operating System, modifying the kernel routine Physio, to enable a single system call to set up a number of concurrent direct memory access (DMA) channels between memory and the data buffers of a device.
Many character device drivers use the UNIX Physio facility for I/O. The traditional implementation of Physio handles I/O in a serial manner by performing gather-write or scatter-read operations. Physio performs this task by calling the Strategy routine of the device driver as many times as the number of data buffers. The net result is that each buffer transfer is done one after the another, serially.
I/O device drivers utilize a kernel routine called Physio. Physio ensures that the user's buffer(s) and the virtual memory mapping information (Page Table Entries) associated with the buffer(s) are all locked into physical memory. Locked means not available for swapping out of physical memory. This "frozen state" is necessary for two reasons: DMA controllers cannot resolve page faults, and the process which initiates the I/O typically blocks (and its pages become candidates for reuse). Physio calls the routine As.sub.-- fault to guarantee that memory and PTEs are locked. This is the same routine called by the trap handler when a page fault occurs. The "as" in As.sub.-- fault refers to the address space structure associated with a process address space. As.sub.-- fault figures out from the virtual address which segment of the process contains the address, and then calls a segment specific routine, which loops over the address range a page at a time calling lower level subroutines which lock the memory and the PTEs (mapping information).
Physio provides several other capabilities. One of the parameters to Physio is a pointer to a routine that calculates the largest possible I/O given the constraints of the DMA hardware. If the size returned by this routine is smaller than the requested I/O size, Physio will break the I/O into smaller chunks that don't violate the constrait. Another function supported by Physio is "scatter-gather" I/O. If the user's data-buffer consists of multiple buffers that are in discontiguous virtual memory, the user can pass the driver a "vector" of structures each of which describes a piece of the total I/O requested. Physio will then process each of these buffers in turn. Physio also provides the mechanism by which the thread of control that does the read or write is put to sleep as the I/O starts and reawakened when the I/O completes. When Physio calls AS.sub.-- fault and then queues the I/O request to the hardware via the driver's strategy routine, Physio sleeps, which means that the requesting thread sleeps. Physio is reawakened by the driver's interrupt service routine when the entire I/O, some part of a vectored I/O, or some part of a partitioned I/O (due to size constraints) completes.
The existing implementation is adequate for hardware devices that have a single I/O channel or are incapable of handling parallel I/O transfers. When more advanced hardware devices with multiple I/O channels are used, the serial behavior of Physio becomes a limiting factor when attempting to parallelize their throughput.
Concurrent real time applications have a problem using physio because multiple I/O channels are set up serially. In a real time system, where multiple channels are required in parallel to provide data at the proper moment, the synchronization of data access becomes difficult. This invention is an enhancement to Physio to support parallel I/O operations for devices capable of or requiring a parallel data transfer, and consists of four new system calls to be added to the original Physio kernel to implement this new capability. The figure on the next page (FIG. 1) captures the essential improvement provided by the invention.